<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">

  <title>for</title>
<script>
	function gugu(){
		var s = Number(document.getElementById("su").value);
		var r = document.getElementById("result");
		var str = "";
		str += "구구단 " + s + "단"+"\n\n";
		for(var i=1; i<10; i++){
			str += s + " * " + i + " = " + (s * i) + "\n";
		}
		r.value = str;
				
	}
</script>
</head>

<body>
<input type="number" id="su" value="5"/>
<input type="button" value="클릭" onclick="gugu()" />
</p>
<textarea id="result" rows="15" cols="22" style="text-align: center;">
	
</textarea>
</body>
</html>
